import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;
import java.util.Vector;


public class Crawler {
	public static void main(String[] args) throws MalformedURLException, IOException {
		Crawler c = new Crawler();
		//c.daumBasketBallCrawler("20111225");
		//c.daumBaseBallCrawler("20110908", "npbp");
		//c.daumFootBallCrawler("20111221", "premier");
		//c.daumFootBallCrawler("20111130", "kleague");
		//c.dosaScoreCrawler("20111225","농구");
		//c.kovoVolleyBallCrawler();
		//c.livescoreFootballCrawler();
		c.livescoreBasketballCrawler();
		//c.livescoreHockeyCrawler();
	}
	
	public String crawler(String address, String charset) throws MalformedURLException, IOException{
		URL targetUrl = new URL(address);
		HttpURLConnection conn = (HttpURLConnection)targetUrl.openConnection();
		
		BufferedReader br = null;
		String source = "";
		String result = "";
		
		br = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset));
						
		while((source = br.readLine()) != null){
			result = result + "\n" + source;
		}
				
		br.close();
		conn.disconnect();
				
		return result;
	}
	
	public String getNowDate(){
		Calendar nCal = Calendar.getInstance();
		String year = Integer.toString(nCal.get(Calendar.YEAR));
		String month = Integer.toString((nCal.get(Calendar.MONTH)+1));
		String day = Integer.toString(nCal.get(Calendar.DAY_OF_MONTH));
		
		if((nCal.get(Calendar.MONTH)+1) < 10)
			month = "0"+month;
		if(nCal.get(Calendar.DAY_OF_MONTH) < 10)
			day = "0"+day;
		
		return  year + month + day;
	}
	
	// 다음 농구 스코어보드에서 긁어오기
	public void daumBasketBallCrawler(String date) throws MalformedURLException, IOException{
		String nowDate = getNowDate();
				
		String daumScoreBoardUrl = "http://sports.media.daum.net/basketball/kbl/schedule/sbrd_main.daum?game_date=";
		if(date == null || date.equals("")){
			date = nowDate;
		}
		daumScoreBoardUrl = daumScoreBoardUrl + date;
						
		String daumYear = date.substring(0, 4);
		String daumMonth = date.substring(4,6);
		String daumDay = date.substring(6);
		
		// 다음 스코어보드에서 점수 화면의 소스만 뽑기
		String daumCrawleResult = crawler(daumScoreBoardUrl, "utf-8");
		daumCrawleResult = daumCrawleResult.substring(daumCrawleResult.indexOf("<!-- //left_area  -->"), daumCrawleResult.indexOf("<!-- //main_area -->"));
				
		int scoreBoardIndex = daumCrawleResult.indexOf("result_brd result_score_brd");
		if(scoreBoardIndex == -1){
			System.out.println("경기가 없습니다.");
			return ;
		}
		
		String daumScoreBoard = "";
		String daumGameState = "";
		String daumGameCategory = "";
		String daumGameStadium = "";
		String daumGameTimeHour = "";
		String daumGameTimeMinute = "";
		String [] daumGameTeam = new String [2];
		String [][] daumGameScore = new String [2][];
		
		int tempIndex = -1;
		
		do{
			// 현재 경기의 테이블 시작 주소
			daumScoreBoard = daumCrawleResult.substring(scoreBoardIndex);
			// 현재 경기의 진행 상황(종료,경기전,진행중)
			if(daumScoreBoard.indexOf("state") == -1)
				daumGameState = "경기전";
			else
				daumGameState = daumScoreBoard.substring(daumScoreBoard.indexOf("state")+7, daumScoreBoard.indexOf(" </p>", daumScoreBoard.indexOf("state")));
			
			// 현재 경기의 종류
			tempIndex = daumScoreBoard.indexOf("info");
			daumGameCategory = daumScoreBoard.substring(daumScoreBoard.indexOf("<p>", tempIndex)+3, daumScoreBoard.indexOf("</p>", tempIndex));
			// 현재 경기의 경기장
			tempIndex = daumScoreBoard.indexOf("</p>", tempIndex) + 4;
			daumGameStadium = daumScoreBoard.substring(daumScoreBoard.indexOf("<p>", tempIndex)+3, daumScoreBoard.indexOf("<em>", tempIndex));
			// 현재 경기의 경기시간
			tempIndex = daumScoreBoard.indexOf("<em>", tempIndex) + 4;
			daumGameTimeHour = daumScoreBoard.substring(tempIndex, daumScoreBoard.indexOf("</em>", tempIndex));
			daumGameTimeMinute = daumGameTimeHour.substring(3, 5);
			daumGameTimeHour = daumGameTimeHour.substring(0, 2);
			
			for(int i=0; i<2; i++){
				tempIndex = daumScoreBoard.indexOf("kl_team", tempIndex + 10);
				daumGameScore[i] = new String[6];
				daumGameTeam[i] = daumScoreBoard.substring(tempIndex + 9, daumScoreBoard.indexOf("</td>", tempIndex));
				for(int j=0; j<6; j++){
					tempIndex = daumScoreBoard.indexOf("kbl_score", tempIndex + 13);
					daumGameScore[i][j] = daumScoreBoard.substring(tempIndex + 11, daumScoreBoard.indexOf("</td>", tempIndex));
					if(daumGameScore[i][j].equals("<span>-</span>")) daumGameScore[i][j] = "-";
				}
			}
			System.out.println(daumYear + "." + daumMonth + "." + daumDay + " " + daumGameTimeHour + " : " + daumGameTimeMinute);
			System.out.println(daumGameState + " , " + daumGameCategory + " , " + daumGameStadium);
			System.out.println(daumGameTeam[0] + "(" + daumGameScore[0][5] + ")" + " vs " + daumGameTeam[1] + "(" + daumGameScore[1][5] + ")");
			System.out.println();
		}while((scoreBoardIndex = daumCrawleResult.indexOf("result_brd result_score_brd", scoreBoardIndex + 30)) != -1);
				
	}
	
	// 다음 야구 스코어보드에서 긁어오기
	public void daumBaseBallCrawler(String date, String league) throws MalformedURLException, IOException{
		String nowDate = getNowDate();
		String daumScoreBoardUrl = "";

		if(league == null || league.equals("")){	league = "kbo"; 	}
		
		if(league.equals("kbo")){
			daumScoreBoardUrl  = "http://sports.media.daum.net/baseball/kbo/schedule/sbrd_main.daum?game_date=";
		}else if(league.equals("mlbn")){
			daumScoreBoardUrl = "http://sports.media.daum.net/worldbaseball/mlb/schedule/sbrd_main.daum?series=n&game_date=";
		}else if(league.equals("mlba")){
			daumScoreBoardUrl = "http://sports.media.daum.net/worldbaseball/mlb/schedule/sbrd_main.daum?series=a&game_date=";
		}else if(league.equals("npbc")){
			daumScoreBoardUrl = "http://sports.media.daum.net/worldbaseball/npb/schedule/sbrd_main.daum?series=c&game_date=";
		}else if(league.equals("npbp")){
			daumScoreBoardUrl = "http://sports.media.daum.net/worldbaseball/npb/schedule/sbrd_main.daum?series=p&game_date=";
		}else{
			return ;
		}
		
		if(date == null || date.equals("")){
			date = nowDate;
		}
		daumScoreBoardUrl = daumScoreBoardUrl + date;
				
		String daumYear = date.substring(0, 4);
		String daumMonth = date.substring(4,6);
		String daumDay = date.substring(6);
				
		// 다음 스코어보드에서 점수 화면의 소스만 뽑기
		String daumCrawleResult = crawler(daumScoreBoardUrl, "utf-8");
		daumCrawleResult = daumCrawleResult.substring(daumCrawleResult.indexOf("<!-- //left_area  -->"), daumCrawleResult.indexOf("<!-- //main_area -->"));
				
		int scoreBoardIndex = daumCrawleResult.indexOf("result_brd result_score_brd");
		if(scoreBoardIndex == -1){
			System.out.println("경기가 없습니다.");
			return ;
		}
		
		String daumScoreBoard = "";
		String daumGameState = "";
		String daumGameCategory = "";
		String daumGameStadium = "";
		String daumGameTimeHour = "";
		String daumGameTimeMinute = "";
		String [] daumGameTeam = new String [2];
		String [][] daumGameScore = new String [2][];
				
		int tempIndex = -1;
		
		do{
			// 현재 경기의 테이블 시작 주소
			daumScoreBoard = daumCrawleResult.substring(scoreBoardIndex);
			// 현재 경기의 진행 상황(종료,경기전,진행중)
			if(daumScoreBoard.indexOf("state") == -1)
				daumGameState = "경기전";
			else
				daumGameState = daumScoreBoard.substring(daumScoreBoard.indexOf("state")+7, daumScoreBoard.indexOf(" </p>", daumScoreBoard.indexOf("state")));
			
			// 현재 경기의 종류
			tempIndex = daumScoreBoard.indexOf("info");
			daumGameCategory = daumScoreBoard.substring(daumScoreBoard.indexOf("<p>", tempIndex)+3, daumScoreBoard.indexOf("</p>", tempIndex));
			// 현재 경기의 경기장
			tempIndex = daumScoreBoard.indexOf("</p>", tempIndex) + 4;
			daumGameStadium = daumScoreBoard.substring(daumScoreBoard.indexOf("<p>", tempIndex)+3, daumScoreBoard.indexOf("<em>", tempIndex));
			// 현재 경기의 경기시간
			tempIndex = daumScoreBoard.indexOf("<em>", tempIndex) + 4;
			daumGameTimeHour = daumScoreBoard.substring(tempIndex, daumScoreBoard.indexOf("</em>", tempIndex));
			daumGameTimeMinute = daumGameTimeHour.substring(3, 5);
			daumGameTimeHour = daumGameTimeHour.substring(0, 2);
			
			for(int i=0; i<2; i++){
				tempIndex = daumScoreBoard.indexOf("kbo_team", tempIndex + 10);
				daumGameScore[i] = new String[16];
				daumGameTeam[i] = daumScoreBoard.substring(tempIndex + 10, daumScoreBoard.indexOf("</td>", tempIndex));
				for(int j=0; j<16; j++){
					tempIndex = daumScoreBoard.indexOf("<td>", tempIndex + 5);
					daumGameScore[i][j] = daumScoreBoard.substring(tempIndex + 4, daumScoreBoard.indexOf("</td>", tempIndex));
					if(j == 12){
						daumGameScore[i][j] = daumGameScore[i][j].substring(8, daumGameScore[i][j].indexOf("</strong>"));
					}
					if(daumGameScore[i][j].equals("<em>-</em>")) daumGameScore[i][j] = "-";
				}
			}
			System.out.println(daumYear + "." + daumMonth + "." + daumDay + " " + daumGameTimeHour + " : " + daumGameTimeMinute);
			System.out.println(daumGameState + " , " + daumGameCategory + " , " + daumGameStadium);
			System.out.println(daumGameTeam[0] + "(" + daumGameScore[0][12] + ")" + " vs " + daumGameTeam[1] + "(" + daumGameScore[1][12] + ")");			
			System.out.println();
		}while((scoreBoardIndex = daumCrawleResult.indexOf("result_brd result_score_brd", scoreBoardIndex + 30)) != -1);
				
	}
	
	// 다음 축구(K리그, 프리미어리그) 스코어보드에서 긁어오기
	public void daumFootBallCrawler(String date, String league) throws MalformedURLException, IOException{
		String nowDate = getNowDate();
		
		if(league == null || league.equals("")){	league = "kleague"; 	}
		
		String daumScoreBoardUrl = "";
		
		if(league.equals("kleague")){
			daumScoreBoardUrl  = "http://sports.media.daum.net/soccer/k_league/schedule/sbrd_main.daum?game_date=";
		}else if(league.equals("premier")){
			daumScoreBoardUrl = "http://sports.media.daum.net/worldsoccer/all/schedule/sbrd_main.daum?game_date=";
		}else{
			return ;
		}
		
		if(date == null || date.equals("")){
			date = nowDate;
		}
		daumScoreBoardUrl = daumScoreBoardUrl + date;
						
		String daumYear = date.substring(0, 4);
		String daumMonth = date.substring(4,6);
		String daumDay = date.substring(6);
		
		// 다음 스코어보드에서 점수 화면의 소스만 뽑기
		String daumCrawleResult = crawler(daumScoreBoardUrl, "utf-8");
		daumCrawleResult = daumCrawleResult.substring(daumCrawleResult.indexOf("<!-- //left_area  -->"), daumCrawleResult.indexOf("<!-- //main_area -->"));
				
		int scoreBoardIndex = daumCrawleResult.indexOf("result_brd result_score_brd");
		if(scoreBoardIndex == -1){
			System.out.println("경기가 없습니다.");
			return ;
		}
		
		String daumScoreBoard = "";
		String daumGameState = "";
		String daumGameCategory = "";
		String daumGameStadium = "";
		String daumGameTimeHour = "";
		String daumGameTimeMinute = "";
		String [] daumGameTeam = new String [2];
		String [][] daumGameScore = new String [2][];
		String [][] daumGameScoreDetail = new String [2][];
		
		int tempIndex = -1; int tempIndex2 = -1;
		do{
			tempIndex2 = daumCrawleResult.indexOf("result_brd result_score_brd", scoreBoardIndex + 30);
			// 현재 경기의 테이블 시작 주소
			if(tempIndex2 != -1)
				daumScoreBoard = daumCrawleResult.substring(scoreBoardIndex, tempIndex2-10);
			else
				daumScoreBoard = daumCrawleResult.substring(scoreBoardIndex);
			
			// 현재 경기의 진행 상황(종료,경기전,진행중)
			if(daumScoreBoard.indexOf("state") == -1)
				daumGameState = "경기전";
			else
				daumGameState = daumScoreBoard.substring(daumScoreBoard.indexOf("state")+7, daumScoreBoard.indexOf(" </p>", daumScoreBoard.indexOf("state")));
			
			// 현재 경기의 종류
			tempIndex = daumScoreBoard.indexOf("info");
			daumGameCategory = daumScoreBoard.substring(daumScoreBoard.indexOf("<p>", tempIndex)+3, daumScoreBoard.indexOf("</p>", tempIndex));
			// 현재 경기의 경기장
			tempIndex = daumScoreBoard.indexOf("</p>", tempIndex) + 4;
			daumGameStadium = daumScoreBoard.substring(daumScoreBoard.indexOf("<p>", tempIndex)+3, daumScoreBoard.indexOf("<em>", tempIndex));
			// 현재 경기의 경기시간
			tempIndex = daumScoreBoard.indexOf("<em>", tempIndex) + 4;
			daumGameTimeHour = daumScoreBoard.substring(tempIndex, daumScoreBoard.indexOf("</em>", tempIndex));
			daumGameTimeMinute = daumGameTimeHour.substring(3, 5);
			daumGameTimeHour = daumGameTimeHour.substring(0, 2);
			// 현재 경기의 스코어 
			for(int i=0; i<2; i++){
				tempIndex = daumScoreBoard.indexOf("kl_team", tempIndex + 10);
				daumGameScore[i] = new String[2];
				daumGameTeam[i] = daumScoreBoard.substring(tempIndex + 9, daumScoreBoard.indexOf("</td>", tempIndex));
				tempIndex = daumScoreBoard.indexOf("kl_score", tempIndex + 13);
				daumGameScore[i][0] = daumScoreBoard.substring(tempIndex + 10, daumScoreBoard.indexOf("</td>", tempIndex));
				tempIndex = daumScoreBoard.indexOf("kl_score2", tempIndex + 13);
				daumGameScore[i][1] = daumScoreBoard.substring(tempIndex + 11, daumScoreBoard.indexOf("</td>", tempIndex));
				
				if(daumGameScore[i][0].equals("<span>-</span>")) daumGameScore[i][0] = "-";
				if(daumGameScore[i][1].equals("<span>-</span>")) daumGameScore[i][1] = "-";
				
			}
			// 현재 경기의 득점자
			tempIndex = daumScoreBoard.indexOf("remark_detail", tempIndex);
			String tempString = "";
			for(int i=0; i<2; i++){
				if(daumScoreBoard.indexOf("<dd>", tempIndex) == -1) break;
				tempString = daumScoreBoard.substring(daumScoreBoard.indexOf("<dd>", tempIndex)+4, daumScoreBoard.indexOf("</dd>", tempIndex));
				tempIndex = daumScoreBoard.indexOf("t0", tempIndex);
				daumGameScoreDetail[i] = tempString.split("<br />");
			}
			
			System.out.println(daumYear + "." + daumMonth + "." + daumDay + " " + daumGameTimeHour + " : " + daumGameTimeMinute);
			System.out.println(daumGameState + " , " + daumGameCategory + " , " + daumGameStadium);
			System.out.println(daumGameTeam[0] + "(" + daumGameScore[0][0] + ")" + " vs " + daumGameTeam[1] + "(" + daumGameScore[1][0] + ")");
			//System.out.println(daumGameScoreDetail[0][0]);
			System.out.println();
		}while((scoreBoardIndex = daumCrawleResult.indexOf("result_brd result_score_brd", scoreBoardIndex + 30)) != -1);
				
	}
	
	// 스포츠 도사 축구 라이브스코어 긁어오기
	public void dosaScoreCrawler(String date, String league) throws MalformedURLException, IOException {
		String nowDate = getNowDate();
		
		if(league == null || league.equals("")){	league = "축구"; 	}
		league = new String(league.getBytes(), "utf-8");
				
		String dosaScoreBoardUrl = "http://www.sportsdosa.com/?template=menu_4_1&type=1&search_category=" + league + "&search_date=";
				
		if(date == null || date.equals("")){
			date = nowDate;
		}
		
		String dosaYear = date.substring(0, 4);
		String dosaMonth = date.substring(4,6);
		String dosaDay = date.substring(6);
		
		dosaScoreBoardUrl = dosaScoreBoardUrl + dosaYear + "-" + dosaMonth + "-" + dosaDay;
		
		
		// 다음 스코어보드에서 점수 화면의 소스만 뽑기
		String dosaCrawleResult = crawler(dosaScoreBoardUrl, "utf-8");
		dosaCrawleResult = dosaCrawleResult.substring(dosaCrawleResult.indexOf("menu_4_1 realscore"), dosaCrawleResult.indexOf("<!-- body -->",dosaCrawleResult.indexOf("menu_4_1 realscore")));
				
		int scoreBoardIndex = 0;
		if(dosaCrawleResult.indexOf("경기 일정이 없습니다.") != -1){
			System.out.println("경기가 없습니다.");
			return ;
		}
		
		String dosaScoreBoard = "";
		String dosaGameState = "";
		String dosaGameTimeHour = "";
		String dosaGameTimeMinute = "";
		String [] dosaGameTeam = new String [2];
		String [] dosaGameScore = new String [2];
		
		scoreBoardIndex = dosaCrawleResult.indexOf("field");
		
		do{
			// 현재 경기의 테이블 시작 주소
			dosaScoreBoard = dosaCrawleResult.substring(scoreBoardIndex);
			// 현재 경기의 팀 이름
			dosaGameTeam[0] = dosaScoreBoard.substring(dosaScoreBoard.indexOf(">", dosaScoreBoard.indexOf("name"))+1, dosaScoreBoard.indexOf("[<span>"));
			dosaScoreBoard = dosaScoreBoard.substring(dosaScoreBoard.indexOf("[<span>")+8);
			dosaGameTeam[1] = dosaScoreBoard.substring(dosaScoreBoard.indexOf(">", dosaScoreBoard.indexOf("name"))+1, dosaScoreBoard.indexOf("[<span>"));
			dosaScoreBoard = dosaScoreBoard.substring(dosaScoreBoard.indexOf("[<span>")+8);
			// 현재 경기의 스코어
			dosaGameScore[0] = dosaScoreBoard.substring(dosaScoreBoard.indexOf("home_score\">")+12,dosaScoreBoard.indexOf("</div>", dosaScoreBoard.indexOf("home_score")));
			dosaGameScore[1] = dosaScoreBoard.substring(dosaScoreBoard.indexOf("away_score\">")+12,dosaScoreBoard.indexOf("</div>", dosaScoreBoard.indexOf("away_score")));
			// 현재 경기의 진행 상황(종료,경기전,진행중)
			dosaGameState = dosaScoreBoard.substring(dosaScoreBoard.indexOf("status")+8, dosaScoreBoard.indexOf("</div>", dosaScoreBoard.indexOf("status")));
			// 현재 경기의 시작 시간
			dosaScoreBoard = dosaScoreBoard.substring(dosaScoreBoard.indexOf("</div>", dosaScoreBoard.indexOf("status")));
			dosaGameTimeHour = dosaScoreBoard.substring(dosaScoreBoard.indexOf("time")+6, dosaScoreBoard.indexOf("</div>", dosaScoreBoard.indexOf("time")+6));
			dosaGameTimeHour = dosaGameTimeHour.trim();
			dosaGameTimeMinute = dosaGameTimeHour.substring(3, 5);
			dosaGameTimeHour = dosaGameTimeHour.substring(0, 2);
			
			System.out.println(dosaYear + "." + dosaMonth + "." + dosaDay + " " + dosaGameTimeHour + " : " + dosaGameTimeMinute);
			System.out.println(dosaGameState);
			System.out.println(dosaGameTeam[0] + "(" + dosaGameScore[0] + ")" + " vs " + dosaGameTeam[1] + "(" + dosaGameScore[1] + ")");
			System.out.println();
		}while((scoreBoardIndex = dosaCrawleResult.indexOf("field", scoreBoardIndex + 10)) != -1);
				
	}
	
	// 코보(한국배구연맹)에서 배구 라이브스코어 긁어오기
	public void kovoVolleyBallCrawler() throws MalformedURLException, IOException {
		String kovoScoreBoardUrl = "http://www.kovo.co.kr/onair/html/onair_detail.html";		
		String kovoCrawleResult = crawler(kovoScoreBoardUrl, "euc-kr");
		
		String kovoScoreBoard = "";
		String [] kovoGameTeam = new String [2];
		String [][] kovoGameScore = new String [2][6];
		
		int scoreBoardIndex = 0;
		if(kovoCrawleResult.indexOf("nogame.gif") != -1){
			System.out.println("경기가 없습니다.");
			return ;
		}
		
		scoreBoardIndex = kovoCrawleResult.indexOf("onairbox");
		do{
			// 현재 경기의 테이블 시작 주소
			kovoScoreBoard = kovoCrawleResult.substring(scoreBoardIndex);
			// 현재 경기의 홈팀 이름
			kovoGameTeam[0] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			// 현재 경기의 홈팀 각 세트의 스코어
			kovoGameScore[0][0] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[0][1] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[0][2] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[0][3] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[0][4] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			// 현재 경기의 홈팀의 세트
			kovoGameScore[0][5] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onset_td")+10, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onset_td")+10));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onset_td")+11);
			
			// 현재 경기의 원정팀 이름
			kovoGameTeam[1] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			// 현재 경기의 원정팀 각 세트의 스코어
			kovoGameScore[1][0] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[1][1] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[1][2] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[1][3] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			kovoGameScore[1][4] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+17, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onrecord_rig_td")+17));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onrecord_rig_td")+18);
			// 현재 경기의 원정팀 세트 스코어
			kovoGameScore[1][5] = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onset_td")+10, kovoScoreBoard.indexOf("</td>", kovoScoreBoard.indexOf("onset_td")+10));
			kovoScoreBoard = kovoScoreBoard.substring(kovoScoreBoard.indexOf("onset_td")+11);
					
			System.out.println(kovoGameTeam[0] + "(" + kovoGameScore[0][5] + ")" + " vs " + kovoGameTeam[1] + "(" + kovoGameScore[1][5] + ")");
			System.out.println(kovoGameTeam[0] + "   " + kovoGameScore[0][0] + " , " + kovoGameScore[0][1] + " , " + kovoGameScore[0][2] + " , " + kovoGameScore[0][3] + " , " + kovoGameScore[0][4]);
			System.out.println(kovoGameTeam[1] + "   " + kovoGameScore[1][0] + " , " + kovoGameScore[1][1] + " , " + kovoGameScore[1][2] + " , " + kovoGameScore[1][3] + " , " + kovoGameScore[1][4]);
			System.out.println();
		}while((scoreBoardIndex = kovoCrawleResult.indexOf("onairbox", scoreBoardIndex + 10)) != -1);
		
	}
	
	// Livescore.com 에서 축구 결과 불러오기
	public void livescoreFootballCrawler() throws MalformedURLException, IOException{
		String scoreBoardUrl = "http://livescore.com/";
		String scoreCrawleResult = crawler(scoreBoardUrl, "utf-8");				
		String scoreBoardMilestone = "<table width=\"468\" bgcolor=\"#666666\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
		int scoreBoardMilestoneIndex = scoreCrawleResult.indexOf(scoreBoardMilestone);
		
		String scoreBoard = scoreCrawleResult.substring(scoreBoardMilestoneIndex+scoreBoardMilestone.length(), scoreCrawleResult.indexOf("</table>", scoreBoardMilestoneIndex + 10));
		
		String scoreSetMilestone = "<tr bgcolor=\"#111111\"><td colspan=\"4\" height=\"4\"></td></tr><tr><td colspan=\"4\" height=\"1\"></td></tr><tr bgcolor=\"#333333\"><td class=\"title\" colspan=\"4\" height=\"18\">";
		String [] scoreGameSet = scoreBoard.split(scoreSetMilestone);
		
		// 읽어올 나라 제한하기.
		String [] selectedCountry = {"Internationals", "England", "Spain", "Italy", "Germany", "France", "Holland", "Porutgal", "Scotland"};
		//String [] selectedCountry = {"Internationals"};
		boolean isSelected = false;
		
		String scoreGameCountry;
		String scoreGameCategory;
		String scoreGameCountryTime;
		String scoreGameSetDate;
		String [] scoreGameDetail;
		String [] scoreGameTeam = new String [2];
		String [][] scoreGameScore = new String[2][];
		Vector<String []> scoreGameScoreDetail = new Vector<String []>();
		String scoreGameTime;
		String scoreGameState;
		
		String scoreDetailSource;
		String [] scoreDetailInfo;
		String [] tempScoreDetailInfo = new String [4];
		
		// 게임 세트마다 나눠서 판독
		for(int i=1; i<scoreGameSet.length; i++){
			isSelected = false;
			scoreGameSet[i] = scoreGameSet[i].replaceAll("&nbsp;", "");
			scoreGameCountry = scoreGameSet[i].substring(scoreGameSet[i].indexOf("<b>")+3, scoreGameSet[i].indexOf("</b>"));
			
			// 선택한 나라의 경기가 아니면 무시하기.
			for(int j=0; j<selectedCountry.length; j++){
				if(scoreGameCountry.equals(selectedCountry[j])){ isSelected = true; break; }
			}
			if(!isSelected) continue;
			
			scoreGameSet[i] = scoreGameSet[i].replaceFirst(" - ", "");
			scoreGameCategory = scoreGameSet[i].substring(scoreGameSet[i].indexOf("</b>")+4, scoreGameSet[i].indexOf("</td>"));
			
			scoreGameSet[i] = ignoreString(scoreGameSet[i], "</td></tr><tr bgcolor=\"#333333\"><td class=\"match-light\" width=\"45\" height=\"18\">");
			
			scoreGameCountryTime = cutString(scoreGameSet[i], "</td><td class=\"match-light\" align=\"right\" width=\"423\" colspan=\"3\">");			
			
			scoreGameSet[i] = ignoreString(scoreGameSet[i], "</td><td class=\"match-light\" align=\"right\" width=\"423\" colspan=\"3\">");
						
			scoreGameSetDate = cutString(scoreGameSet[i], "</td>");
			
			scoreGameSet[i] = scoreGameSet[i].substring(scoreGameSet[i].indexOf("<td width=\"45\" height=\"18\">"));
			
			scoreGameDetail = scoreGameSet[i].split("<td width=\"45\" height=\"18\">");
			
			for(int j=1; j<scoreGameDetail.length; j++){
				scoreGameScoreDetail.clear();
				
				scoreGameState = cutString(scoreGameDetail[j], "</td><td align=\"right\" width=\"186\">");
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "</td><td align=\"right\" width=\"186\">");
				
				scoreGameTeam[0] = cutString(scoreGameDetail[j], "</td><td align=\"center\" width=\"51\">");
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "</td><td align=\"center\" width=\"51\">");
				                            
				scoreGameScore[0] = new String [3];	scoreGameScore[1] = new String [3];
				
				// 게임 스코어 정보 [0][0] : 홈팀  총득, [0][1] : 홈팀 전반 , [0][2] : 홈팀 후반
				// 게임 스코어 정보 [1][0] : 원정팀  총득, [1][1] : 원정팀 전반 , [1][2] : 원정팀 후반
				// 게임 스코어 정보가 없는 경우
				if(scoreGameDetail[j].indexOf("scorelink") == -1){
					scoreGameScore[0][0] = scoreGameDetail[j].substring(0,scoreGameDetail[j].indexOf(" - "));
					scoreGameDetail[j] = scoreGameDetail[j].substring(scoreGameDetail[j].indexOf(" - ") + 3);
					scoreGameScore[1][0] = scoreGameDetail[j].substring(0,scoreGameDetail[j].indexOf("</td>"));
				// 게임 스코어 정보가 있는 경우
				}else{
					// 게임 상세 스코어 정보 주소 가져오기
					scoreDetailSource = scoreGameDetail[j].substring(scoreGameDetail[j].indexOf("href=\"")+6, scoreGameDetail[j].indexOf("\"", scoreGameDetail[j].indexOf("href=\"")+7));
					scoreDetailSource = crawler(scoreBoardUrl + scoreDetailSource,  "utf-8");
					
					scoreDetailSource = ignoreString(scoreDetailSource, "<table bgcolor=\"#666666\" width=\"400\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
					
					//필요없는 구문 지우기
					scoreDetailSource = scoreDetailSource.replaceAll("<tr class=\"dark\">", "");
					scoreDetailSource = scoreDetailSource.replaceAll("<tr class=\"light\">", "");
					
					scoreDetailInfo = scoreDetailSource.split("<td width=\"20\">");
					for(int k = 1; k<scoreDetailInfo.length; k++){
						if(scoreDetailInfo[k].indexOf("goal.gif") == -1 && scoreDetailInfo[k].indexOf("red.gif") == -1 ) continue;
						tempScoreDetailInfo = new String[4];
						// 시간 저장
						tempScoreDetailInfo[1] = scoreDetailInfo[k].substring(0, scoreDetailInfo[k].indexOf("'"));
						
						scoreDetailInfo[k] = ignoreString(scoreDetailInfo[k], "<td width=\"163\" align=\"left\">");
						// 홈팀인 경우
						if(scoreDetailInfo[k].indexOf("<td width=\"163\"></td>") != -1){
							tempScoreDetailInfo[0] = "Home";
							tempScoreDetailInfo[2] = scoreDetailInfo[k].substring(0, scoreDetailInfo[k].indexOf("<img src="));
						// 원정팀인 경우
						}else{
							tempScoreDetailInfo[0] = "Away";
							
							scoreDetailInfo[k] = ignoreString(scoreDetailInfo[k], "</td><td width=\"163\">");
							
							tempScoreDetailInfo[2] = scoreDetailInfo[k].substring(0, scoreDetailInfo[k].indexOf("<img src="));				
						}
						tempScoreDetailInfo[2] = tempScoreDetailInfo[2].trim();	
						if(scoreDetailInfo[k].indexOf("goal.gif") != -1) tempScoreDetailInfo[3] = "Goal";
						else tempScoreDetailInfo[3] = "Red";
						
						scoreGameScoreDetail.add(tempScoreDetailInfo);
					}
					
					scoreGameDetail[j] = scoreGameDetail[j].substring(scoreGameDetail[j].indexOf("\">") + 2);
					scoreGameScore[0][0] = scoreGameDetail[j].substring(0,scoreGameDetail[j].indexOf(" - "));
					scoreGameDetail[j] = scoreGameDetail[j].substring(scoreGameDetail[j].indexOf(" - ") + 3);
					scoreGameScore[1][0] = scoreGameDetail[j].substring(0,scoreGameDetail[j].indexOf("</a>"));
					
					for(int k=0; k<scoreGameScoreDetail.size(); k++){
						System.out.println(scoreGameScoreDetail.get(k)[0] + " : " + scoreGameScoreDetail.get(k)[1] + " : " + scoreGameScoreDetail.get(k)[2] + " : " + scoreGameScoreDetail.get(k)[3]);
					}
				}

				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td width=\"186\">");
				
				scoreGameTeam[1] = cutString(scoreGameDetail[j], "</td>");
								
				System.out.println(scoreGameTeam[0] + "(" + scoreGameScore[0][0] + "}" + " vs " + scoreGameTeam[1] + "(" + scoreGameScore[1][0] + "}");
			}
			//System.out.println(scoreGameCountry + " : " + scoreGameCategory);
			//System.out.println(scoreGameCountryTime);
		}
		
		
	}
	
	// Livescore.com 에서 하키(NHL) 결과 불러오기
	public void livescoreHockeyCrawler() throws MalformedURLException, IOException{
		String scoreBoardUrl = "http://www.livescore.com/hockey/";
		String scoreCrawleResult = crawler(scoreBoardUrl, "utf-8");				
		String scoreBoardMilestone = "<table width=\"468\" bgcolor=\"#666666\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
		int scoreBoardMilestoneIndex = scoreCrawleResult.indexOf(scoreBoardMilestone);
		
		String scoreBoard = scoreCrawleResult.substring(scoreBoardMilestoneIndex+scoreBoardMilestone.length(), scoreCrawleResult.indexOf("</table>", scoreBoardMilestoneIndex + 10));
		
		String scoreSetMilestone = "<tr bgcolor=\"#111111\"><td colspan=\"11\" height=\"4\"></td></tr><tr><td colspan=\"11\" height=\"1\"></td></tr><tr bgcolor=\"#333333\"><td class=\"title\" colspan=\"11\" height=\"18\" width=\"468\">";
		String [] scoreGameSet = scoreBoard.split(scoreSetMilestone);
		
		// 읽어올 나라 제한하기.
		String [] selectedCountry = {"USA / Canada"};
		boolean isSelected = false;
		
		String scoreGameCountry;
		String scoreGameCategory;
		String scoreGameCountryTime;
		String scoreGameSetDate;
		String [] scoreGameDetail;
		String [] scoreGameTeam = new String [2];
		String [][] scoreGameScore = new String[2][];
		String scoreGameTime;
		String scoreGameState;
		
		String tempMilestone;
		String [] tempScore;
		
		// 게임 세트마다 나눠서 판독
		for(int i=1; i<scoreGameSet.length; i++){
			isSelected = false;
			scoreGameSet[i] = scoreGameSet[i].replaceAll("&nbsp;", "");
			scoreGameCountry = scoreGameSet[i].substring(scoreGameSet[i].indexOf("<b>")+3, scoreGameSet[i].indexOf("</b>"));
			
			// 선택한 나라의 경기가 아니면 무시하기.
			for(int j=0; j<selectedCountry.length; j++){
				if(scoreGameCountry.equals(selectedCountry[j])){ isSelected = true; break; }
			}
			if(!isSelected) continue;
						
			scoreGameSet[i] = scoreGameSet[i].replaceFirst(" - ", "");
			scoreGameCategory = scoreGameSet[i].substring(scoreGameSet[i].indexOf("</b>")+4, scoreGameSet[i].indexOf("</td>"));
			
			scoreGameSet[i] = ignoreString(scoreGameSet[i], "<td class=\"match-light\" align=\"right\" width=\"120\" colspan=\"9\">");
						
			scoreGameSetDate = cutString(scoreGameSet[i], "</td>");
			
			scoreGameDetail = scoreGameSet[i].split("<tr><td colspan=\"11\" height=\"1\"></td></tr><tr bgcolor=\"");
			
			for(int j=1; j<scoreGameDetail.length; j++){
				if(scoreGameDetail[j].indexOf("<td width=\"45\" height=\"18\">") == -1) continue;
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td width=\"45\" height=\"18\">");
				
				scoreGameState = cutString(scoreGameDetail[j], "</td>");
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"right\" width=\"270\">");
				
				scoreGameTeam[0] = cutString(scoreGameDetail[j], "</td>");
				scoreGameTeam[0] = scoreGameTeam[0].replaceAll("<b>", "");
				scoreGameTeam[0] = scoreGameTeam[0].replaceAll("</b>", "");
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"center\" width=\"32\"><b>");
				
				scoreGameScore[0] = new String[6];
				scoreGameScore[1] = new String[6];
				
				scoreGameScore[0][0] = cutString(scoreGameDetail[j], "</b>");
								
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "</td><td align=\"center\" width=\"20\">");
				tempMilestone = cutString(scoreGameDetail[j], "</td><td align=\"left\" width=\"10\">)</td>");
				tempMilestone = tempMilestone.replaceAll("</td><td align=\"center\" width=\"20\">", "Q");

				tempScore = tempMilestone.split("Q");
				for(int k=0; k<tempScore.length; k++){
					scoreGameScore[0][k+1] = tempScore[k];
				}
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"right\" width=\"270\">");
				
				scoreGameTeam[1] = cutString(scoreGameDetail[j], "</td>");
				scoreGameTeam[1] = scoreGameTeam[1].replaceAll("<b>", "");
				scoreGameTeam[1] = scoreGameTeam[1].replaceAll("</b>", "");
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"center\" width=\"5\"></td><td align=\"center\" width=\"32\"><b>");
				scoreGameScore[1][0] = cutString(scoreGameDetail[j], "</b>");
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "</td><td align=\"center\" width=\"20\">");
				tempMilestone = cutString(scoreGameDetail[j], "</td><td align=\"left\" width=\"10\">)</td>");
				tempMilestone = tempMilestone.replaceAll("</td><td align=\"center\" width=\"20\">", "Q");

				tempScore = tempMilestone.split("Q");
				for(int k=0; k<tempScore.length; k++){
					scoreGameScore[1][k+1] = tempScore[k];
				}
				
				System.out.println(scoreGameState + " , " + scoreGameCategory);
				System.out.println(scoreGameTeam[0] + "(" + scoreGameScore[0][0] + "}" + " vs " + scoreGameTeam[1] + "(" + scoreGameScore[1][0] + "}");
				System.out.println();
			}			
		}
		
		
	}
	
	// Livescore.com 에서 농구(NBA) 결과 불러오기
	public void livescoreBasketballCrawler() throws MalformedURLException, IOException{
		String scoreBoardUrl = "http://www.livescore.com/basketball/";
		String scoreCrawleResult = crawler(scoreBoardUrl, "utf-8");				
		String scoreBoardMilestone = "<table width=\"468\" bgcolor=\"#666666\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
		int scoreBoardMilestoneIndex = scoreCrawleResult.indexOf(scoreBoardMilestone);
		
		String scoreBoard = scoreCrawleResult.substring(scoreBoardMilestoneIndex+scoreBoardMilestone.length(), scoreCrawleResult.indexOf("</table>", scoreBoardMilestoneIndex + 10));
		
		String scoreSetMilestone = "<tr bgcolor=\"#111111\"><td colspan=\"11\" height=\"4\"></td></tr><tr><td colspan=\"11\" height=\"1\"></td></tr><tr bgcolor=\"#333333\"><td class=\"title\" colspan=\"11\" height=\"18\" width=\"468\">";
		String [] scoreGameSet = scoreBoard.split(scoreSetMilestone);
		
		// 읽어올 나라 제한하기.
		String [] selectedCountry = {"USA"};
		boolean isSelected = false;
		
		String scoreGameCountry;
		String scoreGameCategory;
		String scoreGameCountryTime;
		String scoreGameSetDate;
		String [] scoreGameDetail;
		String [] scoreGameTeam = new String [2];
		String [][] scoreGameScore = new String[2][];
		String scoreGameTime;
		String scoreGameState;
		
		String tempMilestone;
		String [] tempScore;
		
		// 게임 세트마다 나눠서 판독
		for(int i=1; i<scoreGameSet.length; i++){
			isSelected = false;
			scoreGameSet[i] = scoreGameSet[i].replaceAll("&nbsp;", "");
			scoreGameCountry = scoreGameSet[i].substring(scoreGameSet[i].indexOf("<b>")+3, scoreGameSet[i].indexOf("</b>"));
			
			// 선택한 나라의 경기가 아니면 무시하기.
			for(int j=0; j<selectedCountry.length; j++){
				if(scoreGameCountry.equals(selectedCountry[j])){ isSelected = true; break; }
			}
			if(!isSelected) continue;
									
			scoreGameSet[i] = scoreGameSet[i].replaceFirst(" - ", "");
			scoreGameCategory = scoreGameSet[i].substring(scoreGameSet[i].indexOf("</b>")+4, scoreGameSet[i].indexOf("</td>"));
						
			scoreGameSet[i] = ignoreString(scoreGameSet[i], "<td class=\"match-light\" align=\"right\" width=\"218\" colspan=\"9\">");
						
			scoreGameSetDate = cutString(scoreGameSet[i], "</td>");
			
			scoreGameDetail = scoreGameSet[i].split("<tr><td colspan=\"11\" height=\"1\"></td></tr><tr bgcolor=\"");
			
			for(int j=1; j<scoreGameDetail.length; j++){
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td width=\"45\" height=\"18\">");
				
				scoreGameState = cutString(scoreGameDetail[j], "</td>");
				
				if(scoreGameState.indexOf("<img src") != -1){
					scoreGameState = ignoreString(scoreGameState, "<img src=\"http://cdn3.livescore.com/img/flash.gif\" width=\"8\" height=\"8\" border=\"0\"> ");
				}
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"right\" width=\"205\">");
				
				scoreGameTeam[0] = cutString(scoreGameDetail[j], "</td>");
				scoreGameTeam[0] = scoreGameTeam[0].replaceAll("<b>", "");
				scoreGameTeam[0] = scoreGameTeam[0].replaceAll("</b>", "");
				
				// 경기 스코어 : [0] = 총점, [1~4] = 정규 쿼터 득점 , [5] = 연장 득점
				scoreGameScore[0] = new String [6];
				scoreGameScore[1] = new String [6];

				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"center\" width=\"5\"></td><td align=\"center\" width=\"47\"><b>");
				scoreGameScore[0][0] = cutString(scoreGameDetail[j], "</b>");
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "</td><td align=\"center\" width=\"30\">");
				tempMilestone = cutString(scoreGameDetail[j], "</td><td align=\"left\" width=\"10\">)</td>");
				tempMilestone = tempMilestone.replaceAll("</td><td align=\"center\" width=\"30\">", "Q");

				tempScore = tempMilestone.split("Q");
				for(int k=0; k<tempScore.length; k++){
					scoreGameScore[0][k+1] = tempScore[k];
				}
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"right\" width=\"205\">");
				
				scoreGameTeam[1] = cutString(scoreGameDetail[j], "</td>");
				scoreGameTeam[1] = scoreGameTeam[1].replaceAll("<b>", "");
				scoreGameTeam[1] = scoreGameTeam[1].replaceAll("</b>", "");
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "<td align=\"center\" width=\"5\"></td><td align=\"center\" width=\"47\"><b>");
				scoreGameScore[1][0] = cutString(scoreGameDetail[j], "</b>");
				
				scoreGameDetail[j] = ignoreString(scoreGameDetail[j], "</td><td align=\"center\" width=\"30\">");
				tempMilestone = cutString(scoreGameDetail[j], "</td><td align=\"left\" width=\"10\">)</td>");
				tempMilestone = tempMilestone.replaceAll("</td><td align=\"center\" width=\"30\">", "Q");

				tempScore = tempMilestone.split("Q");
				for(int k=0; k<tempScore.length; k++){
					scoreGameScore[1][k+1] = tempScore[k];
				}
				
				System.out.println(scoreGameState + " , " + scoreGameCategory);
				System.out.println(scoreGameTeam[0] + "(" + scoreGameScore[0][0] + "}" + " vs " + scoreGameTeam[1] + "(" + scoreGameScore[1][0] + "}");
				System.out.println();
			}
		}
		
		
	}
		
	// src에서 target까지 짜르기
	private String cutString(String src, String target){
		int index = src.indexOf(target);
		return src.substring(0, index);
	}
	
	// src에서 target까지 무시하기
	private String ignoreString(String src, String target){
		int index = src.indexOf(target);
		return src.substring(index + target.length());
	}

	String naverScheduleUrl = "http://news.naver.com/sports/index.nhn?category=kbl&ctg=schedule";
	String naverScoreBoardUrl = "http://sports.news.naver.com/sports/new/main/scoreboard.nhn";
	String nateScheduleUrl = "http://sports.news.nate.com/schedule";
	
	
	
	
}
